// WinMX Hostfile patcher
// By Andre van Schoubroeck
// www.p2pfs.tk
// Source is under zlib licence

// bugfix : file now win2k compatible
// added new ip's



unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, JvGIF, ExtCtrls, ShellAPI;


type
  TForm1 = class(TForm)
    Label1: TLabel;
    Image1: TImage;
    Button1: TButton;
    Image2: TImage;
    Image3: TImage;
    Label2: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Image1Click(Sender: TObject);
    procedure Image3Click(Sender: TObject);
    procedure Image2Click(Sender: TObject);
    procedure Label2Click(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }

  end;
    procedure patch();
var
  Form1: TForm1;

  Version     : TOSVersionInfo;
  lbRetVal    : Boolean;
  path        : string;
  hostfile    : textfile;
  tempfile    : textfile;
  nt          : boolean;


implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin


  { prepare }
  Version.dwOSVersionInfoSize := SizeOf(Version);
  lbRetVal := GetVersionEx(Version);
  // Prepare to detect the version
  // Don;t ask me about this, i just copied it
  // from the help files

  { windows type detection }
  if (Version.dwPlatformId = 1) then
  begin
  path := 'c:\windows\';
  nt := false;
  end;
  // verify this. don;t have a win9x machine to test
  // how to detect the windows directory if it is not
  // installed in the standard directory
  // something like SystemRoot in WinNT based versions

  if (Version.dwPlatformId = 2) then
  begin;
  path := GetEnvironmentVariable('SystemRoot') + '\system32\drivers\etc\';
  nt := true;
  end;

  // get the system root and add the /system32/drivers/etc
  // so this should work for sure for 2000/xp/2003/vista
  // not sure if the location is also valid for earlier NT 4






  end;


procedure patch();
var
temp : char;
convert : variant;
temp2 : string;

begin
//convert := date;
temp2 := convert;

assign ( hostfile , path + 'hosts');

if FileExists(path + 'hosts') then
  begin
  assign ( tempfile , path + 'hosts_winmx_patch.bak');
  rewrite (tempfile);
  reset (hostfile);
  while not eof(hostfile) do
    begin
    readln ( hostfile , temp );
    writeln ( tempfile, temp );
    end;
  close   ( tempfile );
  END;
  // backup current file

rewrite ( hostfile );

// lets write the data
// new list of ip's
//205.238.40.2
//67.18.233.36
//209.67.209.50
//212.227.64.159
//205.238.40.2


writeln (hostfile,'# Hostfile written by WinMX Hostfile patcher');
writeln (hostfile,'# Have Fun');
writeln (hostfile,'#');
writeln (hostfile,'#  IP          HOSTNAME          COMMENT');
writeln (hostfile,'');
writeln (hostfile,'# standard stuff');
writeln (hostfile,'    127.0.0.1   localhost         # localhost ');
writeln (hostfile,'');
writeln (hostfile,'# WinMX hosts');
writeln (hostfile,'205.238.40.1 winmx.com            ');
writeln (hostfile,'205.238.40.1 www.winmx.com        ');
writeln (hostfile,'67.18.233.36 err.winmx.com        ');
writeln (hostfile,'212.227.64.159 c3310.z1301.winmx.com');
writeln (hostfile,'67.18.233.36 c3311.z1301.winmx.com');
writeln (hostfile,'82.195.155.5 c3312.z1301.winmx.com');
writeln (hostfile,'67.18.233.36 c3313.z1301.winmx.com');
writeln (hostfile,'209.67.209.50 c3314.z1301.winmx.com');
writeln (hostfile,'212.227.64.159 c3315.z1301.winmx.com');
writeln (hostfile,'67.18.233.36 c3316.z1301.winmx.com');
writeln (hostfile,'205.238.40.1 c3317.z1301.winmx.com');
writeln (hostfile,'67.18.233.36 c3318.z1301.winmx.com');
writeln (hostfile,'205.238.40.1 c3319.z1301.winmx.com');
writeln (hostfile,'212.227.64.159 c3310.z1302.winmx.com');
writeln (hostfile,'67.18.233.36 c3311.z1302.winmx.com');
writeln (hostfile,'82.195.155.5 c3312.z1302.winmx.com');
writeln (hostfile,'209.67.209.50 c3313.z1302.winmx.com');
writeln (hostfile,'212.227.64.159 c3314.z1302.winmx.com');
writeln (hostfile,'67.18.233.36 c3315.z1302.winmx.com');
writeln (hostfile,'205.238.40.1 c3316.z1302.winmx.com');
writeln (hostfile,'67.18.233.36 c3317.z1302.winmx.com');
writeln (hostfile,'205.238.40.1 c3318.z1302.winmx.com');
writeln (hostfile,'212.227.64.159 c3319.z1302.winmx.com');
writeln (hostfile,'67.18.233.36 c3310.z1303.winmx.com');
writeln (hostfile,'82.195.155.5 c3311.z1303.winmx.com');
writeln (hostfile,'67.18.233.36 c3312.z1303.winmx.com');
writeln (hostfile,'82.195.155.5 c3313.z1303.winmx.com');
writeln (hostfile,'212.227.64.159 c3314.z1303.winmx.com');
writeln (hostfile,'67.18.233.36 c3315.z1303.winmx.com');
writeln (hostfile,'205.238.40.1 c3316.z1303.winmx.com');
writeln (hostfile,'67.18.233.36 c3317.z1303.winmx.com');
writeln (hostfile,'205.238.40.1 c3318.z1303.winmx.com');
writeln (hostfile,'212.227.64.159 c3319.z1303.winmx.com');
writeln (hostfile,'67.18.233.36 c3310.z1304.winmx.com');
writeln (hostfile,'82.195.155.5 c3311.z1304.winmx.com');
writeln (hostfile,'67.18.233.36 c3312.z1304.winmx.com');
writeln (hostfile,'82.195.155.5 c3313.z1304.winmx.com');
writeln (hostfile,'212.227.64.159 c3314.z1304.winmx.com');
writeln (hostfile,'67.18.233.36 c3315.z1304.winmx.com');
writeln (hostfile,'205.238.40.1 c3316.z1304.winmx.com');
writeln (hostfile,'67.18.233.36 c3317.z1304.winmx.com');
writeln (hostfile,'209.67.209.50 c3318.z1304.winmx.com');
writeln (hostfile,'212.227.64.159 c3319.z1304.winmx.com');
writeln (hostfile,'67.18.233.36 c3310.z1305.winmx.com');
writeln (hostfile,'82.195.155.5 c3311.z1305.winmx.com');
writeln (hostfile,'67.18.233.36 c3312.z1305.winmx.com');
writeln (hostfile,'209.67.209.50 c3313.z1305.winmx.com');
writeln (hostfile,'212.227.64.159 c3314.z1305.winmx.com');
writeln (hostfile,'67.18.233.36 c3315.z1305.winmx.com');
writeln (hostfile,'205.238.40.1 c3316.z1305.winmx.com');
writeln (hostfile,'67.18.233.36 c3317.z1305.winmx.com');
writeln (hostfile,'205.238.40.1 c3318.z1305.winmx.com');
writeln (hostfile,'212.227.64.159 c3319.z1305.winmx.com');
writeln (hostfile,'67.18.233.36 c3310.z1306.winmx.com');
writeln (hostfile,'209.67.209.50 c3311.z1306.winmx.com');
writeln (hostfile,'82.195.155.5 c3312.z1306.winmx.com');
writeln (hostfile,'67.18.233.36 c3313.z1306.winmx.com');
writeln (hostfile,'212.227.64.159 c3314.z1306.winmx.com');
writeln (hostfile,'67.18.233.36 c3315.z1306.winmx.com');
writeln (hostfile,'209.67.209.50 c3316.z1306.winmx.com');
writeln (hostfile,'67.18.233.36 c3317.z1306.winmx.com');
writeln (hostfile,'205.238.40.1 c3318.z1306.winmx.com');
writeln (hostfile,'212.227.64.159 c3319.z1306.winmx.com');
writeln (hostfile,'67.18.233.36 c3520.z1301.winmx.com');
writeln (hostfile,'209.67.209.50 c3521.z1301.winmx.com');
writeln (hostfile,'82.195.155.5 c3522.z1301.winmx.com');
writeln (hostfile,'67.18.233.36 c3523.z1301.winmx.com');
writeln (hostfile,'82.195.155.5 c3524.z1301.winmx.com');
writeln (hostfile,'67.18.233.36 c3525.z1301.winmx.com');
writeln (hostfile,'205.238.40.1 c3526.z1301.winmx.com');
writeln (hostfile,'67.18.233.36 c3527.z1301.winmx.com');
writeln (hostfile,'212.227.64.159 c3528.z1301.winmx.com');
writeln (hostfile,'67.18.233.36 c3529.z1301.winmx.com');
writeln (hostfile,'209.67.209.50 c3520.z1302.winmx.com');
writeln (hostfile,'82.195.155.5 c3521.z1302.winmx.com');
writeln (hostfile,'67.18.233.36 c3522.z1302.winmx.com');
writeln (hostfile,'212.227.64.159 c3523.z1302.winmx.com');
writeln (hostfile,'67.18.233.36 c3524.z1302.winmx.com');
writeln (hostfile,'205.238.40.1 c3525.z1302.winmx.com');
writeln (hostfile,'67.18.233.36 c3526.z1302.winmx.com');
writeln (hostfile,'205.238.40.1 c3527.z1302.winmx.com');
writeln (hostfile,'212.227.64.159 c3528.z1302.winmx.com');
writeln (hostfile,'67.18.233.36 c3529.z1302.winmx.com');
writeln (hostfile,'209.67.209.50 c3520.z1303.winmx.com');
writeln (hostfile,'82.195.155.5 c3521.z1303.winmx.com');
writeln (hostfile,'67.18.233.36 c3522.z1303.winmx.com');
writeln (hostfile,'82.195.155.5 c3523.z1303.winmx.com');
writeln (hostfile,'67.18.233.36 c3524.z1303.winmx.com');
writeln (hostfile,'209.67.209.50 c3525.z1303.winmx.com');
writeln (hostfile,'205.238.40.1 c3526.z1303.winmx.com');
writeln (hostfile,'67.18.233.36 c3527.z1303.winmx.com');
writeln (hostfile,'212.227.64.159 c3528.z1303.winmx.com');
writeln (hostfile,'67.18.233.36 c3529.z1303.winmx.com');
writeln (hostfile,'82.195.155.5 c3520.z1304.winmx.com');
writeln (hostfile,'67.18.233.36 c3521.z1304.winmx.com');
writeln (hostfile,'82.195.155.5 c3522.z1304.winmx.com');
writeln (hostfile,'209.67.209.50 c3523.z1304.winmx.com');
writeln (hostfile,'67.18.233.36 c3524.z1304.winmx.com');
writeln (hostfile,'205.238.40.1 c3525.z1304.winmx.com');
writeln (hostfile,'67.18.233.36 c3526.z1304.winmx.com');
writeln (hostfile,'212.227.64.159 c3527.z1304.winmx.com');
writeln (hostfile,'67.18.233.36 c3528.z1304.winmx.com');
writeln (hostfile,'82.195.155.5 c3529.z1304.winmx.com');
writeln (hostfile,'67.18.233.36 c3520.z1305.winmx.com');
writeln (hostfile,'209.67.209.50 c3521.z1305.winmx.com');
writeln (hostfile,'212.227.64.159 c3522.z1305.winmx.com');
writeln (hostfile,'67.18.233.36 c3523.z1305.winmx.com');
writeln (hostfile,'205.238.40.1 c3524.z1305.winmx.com');
writeln (hostfile,'67.18.233.36 c3525.z1305.winmx.com');
writeln (hostfile,'205.238.40.1 c3526.z1305.winmx.com');
writeln (hostfile,'209.67.209.50 c3527.z1305.winmx.com');
writeln (hostfile,'67.18.233.36 c3528.z1305.winmx.com');
writeln (hostfile,'82.195.155.5 c3529.z1305.winmx.com');
writeln (hostfile,'67.18.233.36 c3520.z1306.winmx.com');
writeln (hostfile,'82.195.155.5 c3521.z1306.winmx.com');
writeln (hostfile,'209.67.209.50 c3522.z1306.winmx.com');
writeln (hostfile,'67.18.233.36 c3523.z1306.winmx.com');
writeln (hostfile,'212.227.64.159 c3524.z1306.winmx.com');
writeln (hostfile,'205.238.40.1 c3525.z1306.winmx.com');
writeln (hostfile,'67.18.233.36 c3526.z1306.winmx.com');
writeln (hostfile,'209.67.209.50 c3527.z1306.winmx.com');
writeln (hostfile,'67.18.233.36 c3528.z1306.winmx.com');
writeln (hostfile,'82.195.155.5 c3529.z1306.winmx.com');
close ( hostfile );



end;
procedure TForm1.Button1Click(Sender: TObject);
begin
patch();
if nt then ShellExecute(Handle, 'open', PChar('ipconfig /flushdns'), nil, nil, SW_SHOWNORMAL);
ShowMessage ('Hostfile Patched, have fun !');

end;

procedure TForm1.Image1Click(Sender: TObject);
begin
ShellExecute(Handle, 'open', PChar('http://www.againsttcpa.com/'), nil, nil, SW_SHOWNORMAL);
end;

procedure TForm1.Image3Click(Sender: TObject);
begin
ShellExecute(Handle, 'open', PChar('http://www.dataretentionisnosolution.com/'), nil, nil, SW_SHOWNORMAL);
end;

procedure TForm1.Image2Click(Sender: TObject);
begin
ShellExecute(Handle, 'open', PChar('http://www.bof.nl/'), nil, nil, SW_SHOWNORMAL);
end;

procedure TForm1.Label2Click(Sender: TObject);
begin
ShellExecute(Handle, 'open', PChar('http://hrb.nukysrealm.net/p2p/'), nil, nil, SW_SHOWNORMAL);
end;

end.














